import { type InjectionKey } from 'vue'
import { createStore, useStore as baseUseStore, type Store } from 'vuex'
import app from './modules/app'
import dict from './modules/dict'
import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import getters from './getters'

// Vue.use(Vuex)
export interface State {
  count: number
}

export const key: InjectionKey<Store<State>> = Symbol()

export const store = createStore({
  modules: {
    app,
    dict,
    user,
    tagsView,
    permission,
    settings,
  },
  getters,
})

export function useStore() {
  return baseUseStore(key)
}

export default store
